<?php
/**
 * Created by PhpStorm.
 * User: bobo
 * Date: 17-12-26
 * Time: 下午12:51
 */
namespace WsdServer\Lib\Validation;

//验证数据
$data = [
    'title' => '88',
    'status' => 'aaa'
];

//验证规则
$rules = [
    'title2' => 'required|integer|min:2|max:3',
    'status' =>'required|integer'
];

//错误消息
$messages = [
];

//属性名称
$attributes = [
    'title' => '名称',
    'status' => '状态'
];

$validator = Validator::getInstance()->make($data, $rules, $messages, $attributes);
if ($validator->fails()) {
    echo '=== validation fail ===/n';
}else{
    echo '=== validation ok ===/n';
}

//输出错误消息
print_r($validator->errors());
